package com.hrt.datasender.datasent.onenet;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import com.btcode.common.MyLog;
import com.btcode.log.ILog;
/**
 *
 * <pre>
 * 注释
 * </pre>
 * @author FAN
 * @date 2018年10月24日下午4:31:52
 */
public class OneNetRead extends Thread{

	public static ILog log = MyLog.getInstance().getLogger(OneNetSender.class.getName());;
	private InputStream is;
	private List<String> arrMsg = new ArrayList<>();


	public void setIs(InputStream is) {
		this.is = is;
	}

	public List<String> getArrMsg() {
		return arrMsg;
	}


	@Override
	public void run() {
		String msg = "";
		byte[] readBuffer = new byte[1024];

		while (true) {
			try {
				is.read(readBuffer);

				msg =  new String(readBuffer).trim();

				arrMsg.add(msg);

				System.out.println(arrMsg);

//				log.info(arrMsg);

			} catch (IOException e) {
				e.printStackTrace();
				 log.error("推送数据出错:", e);
			}
		}
	}

}
